package com.zmc.order.controller;

import java.util.List;

import com.zmc.common.utils.poi.ExcelUtil;
import com.zmc.order.infrastructure.bean.query.PaymentInfoQuery;
import com.zmc.order.infrastructure.bean.vo.PaymentInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.zmc.order.infrastructure.entity.PaymentInfoEntity;
import com.zmc.order.infrastructure.service.PaymentInfoService;
import com.zmc.common.utils.R;

import javax.servlet.http.HttpServletResponse;


/**
 * 支付信息表
 *
 * @author zmc
 * @email 
 * @date 2025-05-22 19:13:03
 */
@RestController
@RequestMapping("payment")
public class PaymentInfoController {
    @Autowired
    private PaymentInfoService paymentInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestBody PaymentInfoQuery query){
        return R.page(paymentInfoService.queryPage(query));
    }

    @PostMapping("/export")
    public void export(HttpServletResponse response, PaymentInfoQuery query) {
        List<PaymentInfoEntity> list = paymentInfoService.selectList(query);
        ExcelUtil<PaymentInfoEntity> util = new ExcelUtil<>(PaymentInfoEntity.class);
        util.exportExcel(response, list, "退款信息");
    }


    /**
     * 信息
     */
    @RequestMapping("/info")
    public R info(@RequestBody PaymentInfoVo vo){
        return R.ok(paymentInfoService.getByOrderSn(vo.getOrderSn()));
    }

}
